﻿using Microsoft.EntityFrameworkCore.ChangeTracking;

namespace OpenPms.Data;
public enum EArchiveType
{
    退房,//改动值PCheckout存储过程需要同步改动
    取消
}
[EntityTypeConfiguration<TArchiveReservationConfig, TArchiveReservation>]
public class TArchiveReservation : TReservationBase
{
    [Display(Name = "类型")]
    public EArchiveType ArchiveType { get; set; }

    [Display(Name = "账务")]
    public List<TArchiveAccount> Accounts { get; set; } = new();
    [Display(Name = "入住单")]
    public List<TArchiveOrder> Orders { get; set; } = new();

}

public class TArchiveReservationConfig : IEntityTypeConfiguration<TArchiveReservation>
{
    public void Configure(EntityTypeBuilder<TArchiveReservation> builder)
    {
        builder.Property(ii => ii.Prices).HasConversion(ii => ii.ToJsonString(), ii => ii.To<List<VPrice>>(), new ValueComparer<List<VPrice>>(false));
        builder.HasIndex(ii => new { ii.HotelId, ii.SouceId });
    }
}


